import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-31
 * Time: 22:06
 */
public class test1 {
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> ret = new ArrayList<>();
        inorder(root,ret);
        return ret;
    }

    private void inorder(TreeNode root, List<Integer> ret) {
        if(root==null){
            return ;
        }
        inorder(root.left,ret);
        ret.add(root.val);
        inorder(root.right,ret);
    }


    class TreeNode{
        TreeNode left;
        TreeNode right;
        int val;

        public TreeNode(TreeNode left,TreeNode right,int val){
            this.val = val;
            this.right = right;
            this.left = left;
        }
    }
}
